<html>
<head><meta charset="utf-8"><title>StringReader::with_str_from_to · t-compiler · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/index.html">t-compiler</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/StringReader.3A.3Awith_str_from_to.html">StringReader::with_str_from_to</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="168403313"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/StringReader%3A%3Awith_str_from_to/near/168403313" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/StringReader.3A.3Awith_str_from_to.html#168403313">(Jun 18 2019 at 13:58)</a>:</h4>
<p><span class="user-mention" data-user-id="123856">@Vadim Petrochenkov</span> am I correct that the closure-based API of <code>with_str_from_to</code> is a historical  accident, and we should just change that to</p>
<div class="codehilite"><pre><span></span>fn str_from_to&lt;T, F&gt;(&amp;self) -&gt; &amp;str
</pre></div>


<p>?</p>



<a name="168403346"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/StringReader%3A%3Awith_str_from_to/near/168403346" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/StringReader.3A.3Awith_str_from_to.html#168403346">(Jun 18 2019 at 13:58)</a>:</h4>
<p>This one: <a href="https://github.com/rust-lang/rust/blob/03769411561f3d282bfeb0e86ca38d898f02cbdb/src/libsyntax/parse/lexer/mod.rs#L345-L351" target="_blank" title="https://github.com/rust-lang/rust/blob/03769411561f3d282bfeb0e86ca38d898f02cbdb/src/libsyntax/parse/lexer/mod.rs#L345-L351">https://github.com/rust-lang/rust/blob/03769411561f3d282bfeb0e86ca38d898f02cbdb/src/libsyntax/parse/lexer/mod.rs#L345-L351</a></p>



<a name="168403375"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/StringReader%3A%3Awith_str_from_to/near/168403375" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/StringReader.3A.3Awith_str_from_to.html#168403375">(Jun 18 2019 at 13:59)</a>:</h4>
<p>(I am back to hacking on that lexer-rewrite PR)</p>



<a name="168404053"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/StringReader%3A%3Awith_str_from_to/near/168404053" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Vadim Petrochenkov <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/StringReader.3A.3Awith_str_from_to.html#168404053">(Jun 18 2019 at 14:06)</a>:</h4>
<p>Yes, it should be able to just return a <code>&amp;str</code>.</p>



<a name="168404129"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/StringReader%3A%3Awith_str_from_to/near/168404129" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Vadim Petrochenkov <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/StringReader.3A.3Awith_str_from_to.html#168404129">(Jun 18 2019 at 14:07)</a>:</h4>
<p>I remember I've seen it before, but for forgot to put it into the list of things to fix.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>